package com.iotechn.unimall.app.api.distribution;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.annotation.param.Range;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.domain.DistributionBalanceDetailDO;
import com.iotechn.unimall.data.domain.DistributionDO;
import com.iotechn.unimall.data.domain.DistributionWithdrawDO;
import com.iotechn.unimall.data.dto.DistributionDTO;
import com.iotechn.unimall.data.dto.DistributionOrderDTO;
import com.iotechn.unimall.data.dto.DistributionUserDTO;
import com.iotechn.unimall.data.model.Page;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rize
 * Date: 2019/11/29
 * Time: 12:20
 */
@HttpOpenApi(group = "distribution", description = "用户分销服务")
public interface DistributionService {

    @HttpMethod(description = "获取用户分销信息")
    public DistributionDTO info(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "创建分销成员")
    public String create(
            @NotNull @HttpParam(name = "distributionId", type = HttpParamType.COMMON, description = "用户分销Id") Long distributionId,
            @NotNull @HttpParam(name = "phone", type = HttpParamType.COMMON, description = "用户手机号") String phone,
            @NotNull @HttpParam(name = "realname", type = HttpParamType.COMMON, description = "用户真实姓名") String realname,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "余额明细")
    public Page<DistributionBalanceDetailDO> balanceDetail(
            @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer pageNo,
            @HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer pageSize,
            @HttpParam(name = "type", type = HttpParamType.COMMON, description = "明细类型1.金额明细 2.冻结金额明细") Integer type,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "提现明细")
    public Page<DistributionWithdrawDO> withdrawDetail(
            @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer pageNo,
            @HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer pageSize,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "获取二维码")
    public String getQRCode(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "获取下线二维码")
    public String getSubQRCode(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "提现API")
    public String withdraw(
            @HttpParam(name = "ip", type = HttpParamType.IP, description = "ip") String ip,
            @NotNull @Range(min = 1) @HttpParam(name = "sum", type = HttpParamType.COMMON, description = "提现金额") Integer sum,
            @HttpParam(name = "distributionId", type = HttpParamType.COMMON, description = "") Long distributionId,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "获取分销余额")
    public Integer balance(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "获取分销订单")
    public Page<DistributionOrderDTO> getOrderPage(
            @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer pageNo,
            @HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer pageSize,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

    @HttpMethod(description = "获取分销用户列表")
    public List<DistributionUserDTO> getUserList(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

}
